@width-mobile: 960px;
@width-small-mobile: 440px;

.line-break {
  display: block;
  height: 8px;
}

button {
  border: 0;
  appearance: none;
  background: none;
  color: var(--color-terminal-base);
  font-size: 16px;
  cursor: pointer;

  &:hover {
    color: var(--color-terminal-accent);
  }
}

span,
p,
div {
  color: var(--color-terminal-base);
  font-size: 16px;
  font-weight: 300;
}

.tab {
  outline: 1px solid var(--color-terminal-border);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-terminal-base);
  width: 100%;
  height: 100%;

  .tab-title {
    position: absolute;
    top: -10px;
    background: var(--color-terminal-background);
    left: 16px;
  }

  .tab-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-top: 14px;
    padding-bottom: 10px;
    overflow: auto;
    scrollbar-width: none;
    // overflow: hidden;

    pre {
      padding-left: 12px;
      padding-right: 12px;
      padding-top: 8px;

      code {
        padding: 0;
      }
    }

    .row {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      height: 30px;
      padding-left: 8px;
      padding-right: 8px;
      flex-shrink: 0;
      cursor: pointer;
      width: max-content;
      min-width: 100%;

      .cell {
        display: flex;
        justify-content: flex-start;
        flex-shrink: 0;
        white-space: pre;

        em {
          color: var(--color-terminal-danger);
          font-style: normal;
        }
      }

      p em {
        color: var(--color-terminal-danger);
        font-style: normal;
      }

      .generate-columns(cell; 12);

      &:hover,
      &.is-active {
        background: var(--color-terminal-hover);
      }

      &.is-not-interactive {
        pointer-events: none;
      }

      &.is-for-code {
        &:hover {
          background: transparent;
        }
      }

      &.is-textual {
        width: unset;
        height: unset;
        line-height: 145%;
      }
      &.is-json {
        gap: 8px;
      }
      &.is-colored {
        > .cell:nth-child(1) {
          color: var(--color-terminal-json-key);
        }
        > .cell:nth-child(2),
        .cell.is-array-value {
          color: var(--color-terminal-json-value);
        }
      }

      &:has(.sub-row) {
        height: unset;
        gap: 0;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;

        > .cell {
          height: 30px;
          align-items: center;
        }
      }

      &.sub-row {
        gap: 8px;
        &:has(.sub-row) {
          gap: 0;
        }
      }
    }

    table {
      padding-top: 4px;
      padding-left: 8px;
      th {
        text-align: left;
      }
      td {
        white-space: nowrap;
        padding-right: 24px;
      }
    }
  }

  .tab-scroller {
    position: absolute;
    height: 90%;
    right: -5.5px;
    width: 10px;
    background: black;
    display: none;
    flex-direction: column;
    align-items: center;

    .up,
    .down {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      // height: 14px;
      background: black;
      color: var(--color-terminal-accent);
    }

    .up {
      padding-bottom: 3px;
    }
    .down {
      padding-bottom: 3px;
    }

    .track {
      height: 100%;
      width: 1px;
      background: var(--color-terminal-accent);
      display: flex;
      justify-content: center;
      position: relative;

      .thumb {
        background: var(--color-terminal-accent);
        position: absolute;
        top: 0;
        width: 10px;
      }
    }
  }

  .tab-title-group {
    position: absolute;
    top: -10px;
    background: var(--color-terminal-background);
    left: 16px;
    display: flex;
    align-items: center;

    .tab-sub-title {
      &:nth-child(n + 2) {
        &:before {
          content: ' — ';
          color: var(--color-terminal-base);
          white-space: pre;
        }
        &:hover:before {
          color: var(--color-terminal-base);
        }
      }

      &.is-active {
        color: var(--color-terminal-accent);
        font-weight: bold;

        &:before {
          font-weight: 400;
        }
      }
    }

    &.for-controls {
      left: unset;
      right: 16px;

      @media screen and (max-width: @width-small-mobile) {
        display: none;
      }
    }

    @media screen and (max-width: @width-small-mobile) {
      top: -9px;

      .tab-sub-title {
        font-size: 14px;
      }
    }
  }

  .tab-sub-content {
    &:not(.is-active) {
      display: none;
    }
  }

  &.is-active {
    outline-color: var(--color-terminal-accent);

    .tab-title {
      font-weight: bold;
      color: var(--color-terminal-accent-selected);

      @media screen and (max-width: @width-small-mobile) {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 90%;
      }
    }

    &.is-scrollable {
      .tab-scroller {
        display: flex;
      }
    }
  }
}
